package com.shujia.wyh.day19;

public class MyStackTest {
    public static void main(String[] args) {
        //创建自定义的类进行测试
        MyStack myStack = new MyStack();

        //向自定义集合中添加元素
        myStack.myAdd("hello");
        myStack.myAdd("world");
        myStack.myAdd("java");
        myStack.myAdd("bigdata");
        myStack.myAdd("hadoop");

//        System.out.println(myStack.myGet());
//        System.out.println(myStack.myGet());
//        System.out.println(myStack.myGet());
//        System.out.println(myStack.myGet());
//        System.out.println(myStack.myGet());
//        System.out.println(myStack.myGet()); //NoSuchElementException

        //循环改进
        while (!myStack.myIsEmpty()){
            System.out.println(myStack.myGet());
        }
    }
}
